<!--
 * @Author: your name
 * @Date: 2021-04-25 11:18:18
 * @LastEditTime: 2021-04-30 13:12:49
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /qugame/work-admin/src/views/user/rentWork.vue
-->
<template>
  <div class="rent-work">
    <div class="tip_list" v-if="tip_res">
      <div class="tip_box">
          <div class="tip_title">租号次数：</div>
          <div class="tip_msg">{{ tip_res.rentAccountNum }} 次</div>
      </div>
      <div class="tip_box">
          <div class="tip_title">平均体验时长：</div>
          <div class="tip_msg">{{ tip_res.avgRentMinute }} 分/单</div>
      </div>
      <div class="tip_box">
          <div class="tip_title">总花费：</div>
          <div class="tip_msg">{{ tip_res.rentPrice }} 元</div>
      </div>
      <div class="tip_box">
          <div class="tip_title">出租次数：</div>
          <div class="tip_msg">{{ tip_res.lendAccountNum }} 次</div>
      </div>
      <div class="tip_box">
          <div class="tip_title">累计收益：</div>
          <div class="tip_msg">{{ tip_res.lendPrice }} 元</div>
      </div>
    </div>
    <el-tabs type="border-card">
      <el-tab-pane :label="`租号订单「${rentNum}」`" :lazy="true">
        <rentList :userId="userId" fromType="1" @getRentNum="getRentNum"/>
      </el-tab-pane>
      <el-tab-pane :label="`出租订单「${tuoguanNum}」`" :lazy="true">
        <tuoguanList :userId="userId" fromType="1" @getTuoguanNum="getTuoguanNum"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import tuoguanList from '@/views/quDeal/orderManage/tuoguanList.vue'
import rentList from '@/views/quDeal/orderManage/rentList.vue'
export default {
  components: {
    tuoguanList,
    rentList
  },
  props: ['userId', 'rentAccount'],
  data () {
    return {
      rentNum: 0,
      tuoguanNum: 0,
      tip_res: null
    }
  },
  methods: {
    getRentNum(val, tip_res) {
      this.rentNum = val
      this.tuoguanNum = this.rentAccount - val
      this.tip_res = tip_res
    },
    getTuoguanNum(val) {
      this.tuoguanNum = val
    }
  },
  mounted() {
    console.log(this.userId, 'ppp')
  },
}
</script>
<style lang="scss" scoped>
  .rent-work {

  }
  .tip_list {
    display: flex;  
    border: solid 1px #dfdfdf;
    border-radius: 5px;
    padding: 10px 30px;
    margin-bottom: 40px;
    .tip_box {
      flex: 1;
      .tip_msg {
          font-size: 14px;
          font-weight: 500;
          color: #393939;
      }
      .tip_title {
          font-size: 12px;
          font-weight: 600;
          color: #9ba0b1;
          margin-bottom: 6px;
      }
    }
    
  }
</style>
